﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web
{
    public partial class albumResult : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string key = Request.Params["key"];
            List<Model.Album> albumlist = new List<Model.Album>();
            BLL.SearchBLL searchBLL = (BLL.SearchBLL)BLLFAC.DataAccess.CreateSearch();
            if (0 != key.Length)
            {
                albumlist = searchBLL.searchAlbum(key);

                if (0 != albumlist.Capacity)
                {
                    Repeater1.DataSource = albumlist;
                    Repeater1.DataBind();
                }
            }

        }

        protected void Search_Click(object sender, EventArgs e)
        {
            string userKey = TextBox_Search.Text;
            string url = "albumResult.aspx?key=" + TextBox_Search.Text;
            Response.Redirect(url);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            BLL.UserBLL userBll = (BLL.UserBLL)BLLFAC.DataAccess.CreateUser();
            //DAL.UserLoginDAL userLogin = (DAL.UserLoginDAL)DALFAC.DataAccess.CreateUserLogin();
            if (null != userBll)
            {
                if (0 == userBll.Login(TextBox1.Text, TextBox2.Text))
                {
                    Session["username"] = TextBox1.Text;
                    Response.Redirect("usermain.aspx");

                }
            }
            else
            {
                Session.Clear();
                Response.Redirect("Error.aspx");
            }
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Session.Clear();
            Response.Redirect("register.aspx");
        }
    }
}